#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include<string.h>
#include<sys/socket.h>
#include<ctype.h>
//#include<sys/type.h>
#include<arpa/inet.h>
int main(void)
{

    int cfd;
     cfd=socket(AF_INET,SOCK_STREAM,0);

     struct sockaddr_in serv_addr;
     serv_addr.sin_family=AF_INET;
     serv_addr.sin_port=htons(9527);
     inet_pton(AF_INET,"127.0.0.1",&serv_addr.sin_addr.s_addr);

     connect(cfd,(struct sockaddr*)&serv_addr,sizeof(serv_addr));

     int count=10;
     char buf[1024];
     int ret;
     while(count--)
     {

         write(cfd,"hello",5);

         ret=read(cfd,buf,sizeof(buf));
         write(STDOUT_FILENO,buf,ret);
         sleep(1);
     }
}
